package com.myCommon.security.customerCheck;

import com.myCommon.security.entity.LoginUser;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class CustomAuthorityCheck {
      
      public boolean hasCustomAuthority(String data){
            Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
            LoginUser loginUser = (LoginUser) authentication.getPrincipal();
            List<String> userAuthList = loginUser.getUserAuthList();
            return userAuthList.contains(data);
            
      }
}
